﻿<?php
/**
* List Deal Merchant
*/
class Guest_StoreController extends Zend_Controller_Action{
		
	function init(){
            // System_Template::using('view-without-category','Guest');
			System_Template::using('view-with-category','Guest');
			
			$writer = new Zend_Log_Writer_Stream(APPLICATION_PATH.'/log.txt');
			$this->logger = new Zend_Log($writer);
			
			// Lấy các parameter trong request URL
            $this->Params = $this->getRequest()->getParams();            
            $this->view->controller = $this->Params['controller'];
            $this->model = new Admin_Model_Store();
            parent::init();
	}
	
	/**
	* Show list store
	*/
	function indexAction(){
		
	}
	
	/**
	* Show store detail info
	*/
	function detailAction(){
		System_Template::using('view-detail-without-category','Guest');
		//Dien thong tin tinh thanh quan huyen o day.	
		$this->view->listTinhThanh = $this->model->SelectAllCity();	
		
		$id = $this->_request->getParam("id");
		if (!isset($id) || $id == 0 || $id == '') {
			//Only for test
			$data = $this->model->FindById(28);
			$this->view->data = $data;
			$storecategoryid = $data['STORECATEGORYID'];
			//
			return;		
		} else {
			$data = $this->model->FindById($id);
			$this->view->data = $data;
			$storecategoryid = $data['STORECATEGORYID'];
			
		}
		$this->view->logolnk = $this->model->GetMediaFilePath($id, 1);
		$this->view->image1lnk = $this->model->GetMediaFilePath($id, 2);
		//$this->view->image2lnk = $this->model->GetMediaFilePath($id, 3);
		//$this->view->image3lnk = $this->model->GetMediaFilePath($id, 4);
		$this->listworkingtime = explode(",", $data['WORKINGTIME']);
	}
}